package com.zjfgz.lib_kt_com.user

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import com.zjfgz.lib_kt_com.R
import com.zjfgz.lib_kt_com.base.BaseApp
import com.zjfgz.lib_kt_com.mvp.baseui.activity.BaseActivity
import kotlinx.android.synthetic.main.activity_about_us.*
import kotlinx.android.synthetic.main.activity_about_us.toolbar

abstract class AboutUsActivity : BaseActivity(){

    companion object{
        fun show(context: Context){
            val intent = Intent(context,AboutUsActivity::class.java)
            context.startActivity(intent)
        }
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(getLayout())
        initToolbar()
        tv_name.text  = BaseApp.instance.getAppName()
        tv_version.text = BaseApp.instance.getAppVersion()
        iv_logo.setImageResource(BaseApp.instance.getAppLogo())

        tv_yinsi.setOnClickListener {
            XieyiActivity.showYinSi(this@AboutUsActivity,getXieYiClass())
        }

        tv_yhxy.setOnClickListener {
            XieyiActivity.showXieYi(this@AboutUsActivity,getXieYiClass())
        }
    }

    private fun initToolbar(){
        toolbar.setNavigationOnClickListener {
            finish()
        }
        toolbar.setNavigationIcon(R.drawable.ic_arrow_back)
        toolbar.title = "关于我们"
    }

    open fun getLayout() : Int{
      return  R.layout.activity_about_us
    }

    override val layoutId: Int
        get() = R.layout.activity_about_us

    override fun initView(rootView: View) {

    }

    open fun getXieYiClass(): Class<out XieyiActivity>{
        return XieyiActivity::class.java
    }

}